﻿using System;
using System.ComponentModel;

namespace SedionFormDesigner.Infrastructure
{
    public class PropertyGridSite : System.ComponentModel.ISite
    {
        private IServiceProvider serviceProvider;
        private IComponent component;

        public PropertyGridSite(IServiceProvider serviceProvider, IComponent component)
        {
            this.serviceProvider = serviceProvider;
            this.component = component;
        }

        #region ISite 成员

        public IComponent Component
        {
            get { return component; }
        }

        public IContainer Container
        {
            get { return null; }
        }

        public bool DesignMode
        {
            get { return false; }
        }

        public string Name
        {
            get
            {
                return null;
            }
            set
            {

            }
        }

        #endregion

        #region IServiceProvider 成员

        public object GetService(Type serviceType)
        {
            if (serviceProvider != null)
                return serviceProvider.GetService(serviceType);

            return null;
        }

        #endregion
    }
}
